/*
 * Singularity Engine
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */

package org.singularity.io;

import java.io.IOException;


/**
 * @author vjache
 *
 */
public abstract class AbstractTransitPipe<VT,VT1> implements CloseablePipe<VT>{
	
	protected final CloseablePipe<VT1> _next;

	protected AbstractTransitPipe(CloseablePipe<VT1> aNextOne)
	{
		_next = onSetUpPipe(aNextOne);
	}

	@Override
	public void flush() throws IOException {
		_next.flush();
	}
	
	protected CloseablePipe<VT1> onSetUpPipe(CloseablePipe<VT1> aNextOne)
	{
		return aNextOne;
	}
	
	@Override
	public void close() throws IOException {
		flush();
		_next.close();
	}

}
